package nuist.hanniko.stu.webbackend.dao.mapper;

import nuist.hanniko.stu.webbackend.model.User;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;

@Component
public interface UserMapper {
    @Insert("insert into user(uid, password, name) values (#{uid},#{password},#{name})")
    void add(User user);

    @Select("select uid,password,name from user where uid = #{id}")
    @Results({
            @Result(property = "password", column = "password"),
            @Result(property = "name", column = "name")
    })
    User selectUserById(String id);

    @Update("update user set password=#{password},name=#{name} where uid=#{uid}")
    void updateUserById(User user);
}
